package com.hand.cloud.controller;

import com.hand.cloud.entity.User;
import com.hand.cloud.service.UserClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/consumer/user")
public class UserController {

    @Autowired
    UserClientService userClientService;

    @GetMapping("/list")
    public List<User> list(){
        return userClientService.queryAll();
    }

    @GetMapping("/get/{id}")
    public User get(@PathVariable("id") Integer id){
        return userClientService.queryOne(id);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody User user){
        return userClientService.addUser(user);
    }

}
